/*
============================================================================
 Name        : ShoutcastPlayer.cpp
 Author      : 
 Version     :
 Copyright   : Your copyright notice
 Description : CShoutcastPlayer implementation
============================================================================
*/

#include "ShoutcastPlayer.h"
#include "StreamWriter.h"

CShoutcastPlayer::CShoutcastPlayer(MShoutcastPlayerObserver& aObserver)
: iObserver(aObserver)
{
}

CShoutcastPlayer::~CShoutcastPlayer()
{
}

CShoutcastPlayer* CShoutcastPlayer::NewLC(MShoutcastPlayerObserver& aObserver)
{
	CShoutcastPlayer* self = new (ELeave)CShoutcastPlayer(aObserver);
	CleanupStack::PushL(self);
	self->ConstructL();
	return self;
}

CShoutcastPlayer* CShoutcastPlayer::NewL(MShoutcastPlayerObserver& aObserver)
{
	CShoutcastPlayer* self = CShoutcastPlayer::NewLC(aObserver);
	CleanupStack::Pop(); // self;
	return self;
}

void CShoutcastPlayer::ConstructL()
{
	//Base construction
	CStreamPlayer::ConstructL();

	//Create reader and writer
	iReader = CShoutcastReader::NewL((MShoutcastPlayerObserver&)iObserver);
	SetReaderL(iReader);
	SetWriterL(CStreamWriter::NewL((MStreamBufferObserver&)iObserver));
}

const TDesC& CShoutcastPlayer::GetServerName()
{
	return iReader->GetServerName();
}